<Project DefaultTargets="Build">
  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

  <PropertyGroup>
    <PackageDescription>Provides the tasks+targets, for consumption by ios and android based workloads</PackageDescription>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="$(RepoTasksDir)LibraryBuilder\LibraryBuilder.csproj" />

    <PackageFile Include="Sdk\AutoImport.props" TargetPath="Sdk" />
    <PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\android\build\AndroidBuild.props" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\android\build\AndroidBuild.targets" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\apple\build\AppleBuild.props" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\apple\build\AppleBuild.targets" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\common\LibraryBuilder.props" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\common\LibraryBuilder.targets" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\common\CommonMobileBuild.props" TargetPath="Sdk" />
    <PackageFile Include="$(RepoRoot)\src\mono\msbuild\common\RuntimeComponentManifest.targets" TargetPath="Sdk" />
  </ItemGroup>

  <Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
    <PropertyGroup>
      <SdkTargetsPath>$(IntermediateOutputPath)Sdk.targets</SdkTargetsPath>
    </PropertyGroup>

    <ItemGroup>
      <_ReplacementValue Include="NetCoreAppToolCurrent" Value="$(NetCoreAppToolCurrent)" />
      <_ReplacementValue Include="NetFrameworkToolCurrent" Value="$(NetFrameworkToolCurrent)" />
    </ItemGroup>

    <GenerateFileFromTemplate
      TemplateFile="Sdk/Sdk.targets.in"
      Properties="@(_ReplacementValue->'%(Identity)=%(Value)')"
      OutputPath="$(SdkTargetsPath)" />

    <ItemGroup>
      <PackageFile Include="$(SdkTargetsPath)" TargetPath="Sdk" />
    </ItemGroup>
  </Target>

  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
